/**
 * ===========================================================================
 * File:   color-convert.h
 * Author: gustavo
 *
 * Created on November 12, 2010, 2:17 PM
 * ---------------------------------------------------------------------------
 *
 *  Copyright (C) 2010  Gustavo Teodoro Laureano
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ===========================================================================
 **/


#ifndef COLOR_CONVERT_H
#define	COLOR_CONVERT_H

#include "../image.h"

#ifdef	__cplusplus
extern "C" {
#endif



    /**
     * @Description:
     *      Convert rgb image to gray image
     *
     * @param width
     * @param height
     * @param rgb
     * @param gray
     */
    void imp_rgb24_to_gray8(int width, int height, const unsigned char* rgb, unsigned char* gray);
    /**
     * @Description:
     *      convert a rgb image to hsv image
     */
    void imp_rgb_to_hsv(unsigned char * rgb, float * hsv, int width, int height);
    /**
     * @Description:
     *      convert a hsv image to rgb image
     */
    void imp_hsv_to_rgb(float * hsv, unsigned char * rgb, int width, int height);
    /**
     * @Description
     *      convert a hsv image to visible image.
     *      each pixel is normalized to interval [0,255].
     */
    void imp_hsv_to_view(float * hsv, unsigned char * view, int width, int height);

    /**
     * @Description:
     *      convert a yuv240p image to gray image
     *
     * @param yuv
     * @param gray
     * @param width
     * @param height
     */
    void imp_yuv420p_to_gray( const unsigned char * yuv, unsigned char * gray, int width, int height);

    /**
     * @Description
     *      convert a yuv240p image to rgb24 image.
	 * 
     * @param yuv
     * @param rgb
     * @param width
     * @param height
     * @param yvu_flag
     */
	void imp_yuv420p_to_rgb24( const unsigned char * yuv, unsigned char * rgb, int width, int height, int yvu_flag);
	
	void old_imp_yuv420p_to_rgb24(const unsigned char * src, unsigned char * dest, int width, int height, int yvu);
    
	
	
	
	void image_yuv420p_to_gray( Image * YUV, Image ** Gray );
	
#ifdef	__cplusplus
}
#endif

#endif	/* COLOR_CONVERT_H */
